gnome-gmush.png \
gnome-gsame.png \
gnu-keys.png \
- gtk-logo-24.png \
- gtk-logo-48.png \
- gtk-logo-old.png \
messages.txt \
css_accordion.css \
css_basics.css \
gpointer user_data)
{
GtkWidget *window = user_data;
- GdkPixbuf *pixbuf;
const gchar *authors[] = {
"Peter Mattis",
NULL
};
- pixbuf = gdk_pixbuf_new_from_resource ("/application/gtk-logo-48.png", NULL);
-
gtk_show_about_dialog (GTK_WINDOW (window),
"program-name", "GTK+ Code Demos",
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
"comments", "Program to demonstrate GTK+ functions.",
"authors", authors,
"documenters", documentors,
- "logo", pixbuf,
+ "logo-icon-name", "gtk3-demo",
"title", "About GTK+ Code Demos",
NULL);
- g_object_unref (pixbuf);
}
static void
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/application">
- <file preprocess="to-pixdata">gtk-logo-24.png</file>
- <file preprocess="to-pixdata">gtk-logo-48.png</file>
<file>application.ui</file>
<file>menus.ui</file>
</gresource>
<gresource prefix="/images">
<file>alphatest.png</file>
<file>floppybuddy.gif</file>
- <file>gtk-logo-old.png</file>
</gresource>
<gresource prefix="/pixbufs">
<file>apple-red.png</file>
</gresource>
<gresource prefix="/textview">
<file>floppybuddy.gif</file>
- <file>gtk-logo-old.png</file>
</gresource>
<gresource prefix="/listbox">
<file>listbox.ui</file>
<file>messages.txt</file>
- <file>gtk-logo-48.png</file>
<file>apple-red.png</file>
</gresource>
</gresources>
GtkWidget *image;
GtkWidget *label;
GtkWidget *button;
- GdkPixbuf *pixbuf;
GIcon *gicon;
if (!window)
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
- pixbuf = gdk_pixbuf_new_from_resource ("/images/gtk-logo-old.png", NULL);
- /* The image loading must work, we ensure that the resources are valid. */
- g_assert (pixbuf);
-
- image = gtk_image_new_from_pixbuf (pixbuf);
+ image = gtk_image_new_from_icon_name ("gtk3-demo", GTK_ICON_SIZE_DIALOG);
gtk_container_add (GTK_CONTAINER (frame), image);
#include <stdlib.h>
#include <string.h>
-static GdkPixbuf *avatar_pixbuf_gtk;
static GdkPixbuf *avatar_pixbuf_other;
static GtkWidget *window = NULL;
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
- gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_gtk);
+ gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo", GTK_ICON_SIZE_DND);
else
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
if (!window)
{
- avatar_pixbuf_gtk = gdk_pixbuf_new_from_resource_at_scale ("/listbox/gtk-logo-48.png", 32, 32, FALSE, NULL);
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
return box;
}
-static void
-setup_default_icon (void)
-{
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_new_from_resource ("/application/gtk-logo-48.png", NULL);
- /* We load a resource, so we can guarantee that loading it is successful */
- g_assert (pixbuf);
-
- gtk_window_set_default_icon (pixbuf);
-
- g_object_unref (pixbuf);
-}
-
int
main (int argc, char **argv)
{
gtk_init (&argc, &argv);
- setup_default_icon ();
+ gtk_window_set_default_icon_name ("gtk3-demo");
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GTK+ Code Demos");
<property name="can_focus">False</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
- <property name="resource">/application/gtk-logo-48.png</property>
+ <property name="icon-name">gtk3-demo</property>
</object>
<packing>
<property name="name">page1</property>
GtkTextIter iter;
GtkTextIter start, end;
GdkPixbuf *pixbuf;
- GdkPixbuf *scaled;
-
- pixbuf = gdk_pixbuf_new_from_resource ("/textview/gtk-logo-old.png", NULL);
+ GtkIconTheme *icon_theme;
+
+ icon_theme = gtk_icon_theme_get_default ();
+ pixbuf = gtk_icon_theme_load_icon (icon_theme,
+ "gtk3-demo",
+ 32,
+ GTK_ICON_LOOKUP_GENERIC_FALLBACK,
+ NULL);
g_assert (pixbuf);
- scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
- pixbuf = scaled;
-
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
*/